package com.web.exiaodao.remote.service;

import com.web.exiaodao.business.constant.JConstant;
import com.web.exiaodao.business.entity.Order;
import com.web.exiaodao.remote.vo.OrderDetailVo;
import com.web.exiaodao.remote.vo.OrderVo;
import com.web.webstart.base.service.ApiBaseService;
import com.web.webstart.base.util.result.XaResult;
import com.web.webstart.base.exception.BusinessException;

import java.util.List;

/**
 * @ClassName: 订单
 * @Description:
 * @author duandazhi
 * @date 2016/12/20 下午3:12
 */ 
public interface ApiOrderService extends ApiBaseService<OrderVo, Order> {


    /**
     * 下单(消费类下单; 兑换商品下单)
     * @param order
     * @return
     */
    public XaResult<OrderVo> saveSericeOrder(Order order) throws BusinessException;

    /**
     * 下单(普通商品)
     * @param order
     * @return
     */
    public XaResult<OrderVo> saveShopOrder(Order order, List<OrderDetailVo> details, String carIds) throws BusinessException;;

    /**
     * 取消订单
     * @param orderNo
     * @return
     */
    public XaResult<OrderVo> cancelOrder(String orderNo)  throws BusinessException;

    /**
     * 确认收货
     * @param orderNo
     * @return
     */
    public XaResult<OrderVo> cofirmRevice(String orderNo)  throws BusinessException;

    /**
     * 获取订单
     * @param orderNo
     * @return
     */
    public Order getOrder(String orderNo)   throws BusinessException;

    /**
     * 查询订单详情
     * @param orderNo
     * @return
     */
    public XaResult<OrderVo> findDetail(String orderNo)   throws BusinessException;


    /**
     * 查询订单信息
     * @throws BusinessException
     */
    public XaResult<OrderVo> findOrderInfoByOrderNo(String orderNO) throws BusinessException;


    /**
     * 支付成功后处理订单状态
     * @param orderNo 订单编号
     * @param price  支付宝,微信,银联等支付的总金额
     * @param queryId  支付宝,微信,银联自己产生的交易号
     * @param payType  {@link JConstant.PayType}
     * @return
     * @throws BusinessException
     */
    public String modifyOrder(String orderNo, String price, String queryId, int payType)   throws BusinessException;

    /**
     * 更改退款信息
     * @param orderNo
     * @return
     */
    public String modifyOrderRefund(String orderNo, Integer refundStatus, int payType);

    /**
     * 我的订单列表
     * @param userId
     * @param orderState 多种状态,分隔;可以为空
     * @param orderType 多种状态,分隔;可以为空
     * @param begin
     * @param count
     * @return
     */
    public XaResult<List<OrderVo>> getOrders(Long userId, String orderState, String orderType, Integer begin, Integer count)   throws BusinessException;


    //测试Transactional
    public void testTransactionals ()   throws BusinessException;
}
